package com.ruoyi.asms.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.asms.domain.AsmsFault;
import com.ruoyi.asms.mapper.AsmsFaultMapper;
import com.ruoyi.asms.service.IAsmsFaultService;
import com.ruoyi.common.core.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 故障信息Service业务层处理
 * 
 * @author yfkj
 * @date 2021-11-01
 */
@Service
public class AsmsFaultServiceImpl extends ServiceImpl<AsmsFaultMapper, AsmsFault>  implements IAsmsFaultService
{
    @Autowired
    private AsmsFaultMapper asmsFaultMapper;

    /**
     * 查询故障信息
     * 
     * @param faultId 故障信息主键
     * @return 故障信息
     */
    @Override
    public AsmsFault selectAsmsFaultByFaultId(Long faultId)
    {
        return asmsFaultMapper.selectAsmsFaultByFaultId(faultId);
    }

    /**
     * 查询故障信息列表
     * 
     * @param asmsFault 故障信息
     * @return 故障信息
     */
    @Override
    public List<AsmsFault> selectAsmsFaultList(AsmsFault asmsFault)
    {
        return asmsFaultMapper.selectAsmsFaultList(asmsFault);
    }

    /**
     * 新增故障信息
     * 
     * @param asmsFault 故障信息
     * @return 结果
     */
    @Override
    public int insertAsmsFault(AsmsFault asmsFault)
    {
        asmsFault.setCreateTime(System.currentTimeMillis());
        asmsFault.setCreateBy(SecurityUtils.getUsername());
        return asmsFaultMapper.insertAsmsFault(asmsFault);
    }

    /**
     * 修改故障信息
     * 
     * @param asmsFault 故障信息
     * @return 结果
     */
    @Override
    public int updateAsmsFault(AsmsFault asmsFault)
    {
        asmsFault.setUpdateTime(System.currentTimeMillis());
        asmsFault.setUpdateBy(SecurityUtils.getUsername());

        return asmsFaultMapper.updateAsmsFault(asmsFault);
    }

    /**
     * 批量删除故障信息
     * 
     * @param faultIds 需要删除的故障信息主键
     * @return 结果
     */
    @Override
    public int deleteAsmsFaultByFaultIds(Long[] faultIds)
    {
        return asmsFaultMapper.deleteAsmsFaultByFaultIds(faultIds);
    }

    /**
     * 删除故障信息信息
     * 
     * @param faultId 故障信息主键
     * @return 结果
     */
    @Override
    public int deleteAsmsFaultByFaultId(Long faultId)
    {
        return asmsFaultMapper.deleteAsmsFaultByFaultId(faultId);
    }
}
